
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
	<title>部门管理-添加</title>
	#@head()
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							
							<div class="form-group">
								<label class="col-sm-3 control-label">上级部门：</label>
								<div class="col-sm-8">
									<input id="parentId" name="bean.parentId" value="#(parent.id)"
										class="form-control hidden" type="hidden">
								</div>
								<div class="col-sm-8">
									<input id="pName" name="bean.parentName" value="#(parent.name)"
										class="form-control" type="text" readonly>
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-3 control-label">类型：</label>
								<div class="col-sm-8 i-checks">
									#for(item : typeList)
									<label class="radio-inline"> 
										<input type="radio" name="bean.type" class="required" value="#(item.value)" #if(parent.type==item.value) checked="checked" #end> #(item.name)
									</label> 
									#end
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-3 control-label">名称：</label>
								<div class="col-sm-8">
									<input id="name" name="bean.name" class="form-control required" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">排序：</label>
								<div class="col-sm-8">
									<input id="orderNum" name="bean.orderNum" class="form-control required" type="text" value="10">
								</div>
							</div>
							
							
							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	#@footer()
	
<script type="text/javascript">
	
	$().ready(function() {
		validateRule();
	});

	function save() {
		$.ajax({
			cache : true,
			type : "POST",
			url : "save",
			data : $('#signupForm').serialize(),// 你的formid
			async : false,
			error : function(request) {
				parent.layer.alert("Connection error");
			},
			success : function(data) {
				if (data.code == 0) {
					parent.layer.msg("操作成功");
					var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
					parent.reLoad();
					parent.layer.close(index);

				} else {
					parent.layer.alert(data.msg)
				}

			}
		});

	}
	function validateRule() {
		var icon = "<i class='fa fa-times-circle'></i> ";
		$("#signupForm").validate({
			submitHandler : function() {
				save();
			}
		})
	}
</script>
</body>
</html>

